Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

powerbi-client

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

powerbi-client

JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and res

  • 2.23.7
  • beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
155K
decreased by-16.89%
Maintainers
2
Weekly downloads
 
Created

What is powerbi-client?

The powerbi-client npm package is a JavaScript library that allows developers to embed Power BI reports, dashboards, and tiles into their web applications. It provides a set of APIs to interact with the embedded content, enabling functionalities such as filtering, setting parameters, and capturing events.

What are powerbi-client's main functionalities?

Embed a Power BI Report

This code demonstrates how to embed a Power BI report into a web application. It uses the powerbi-client library to configure the embedding settings and then embeds the report into a specified HTML container.

const powerbi = require('powerbi-client');
const models = powerbi.models;

const embedConfiguration = {
  type: 'report',
  id: 'your-report-id',
  embedUrl: 'your-embed-url',
  accessToken: 'your-access-token',
  tokenType: models.TokenType.Embed,
  settings: {
    filterPaneEnabled: false,
    navContentPaneEnabled: false
  }
};

const reportContainer = document.getElementById('reportContainer');
powerbi.embed(reportContainer, embedConfiguration);

Apply Filters to a Report

This code sample shows how to apply a filter to an embedded Power BI report. It creates a filter object and then uses the getFilters and setFilters methods to apply the filter to the report.

const filter = {
  $schema: 'http://powerbi.com/product/schema#basic',
  target: {
    table: 'Sales',
    column: 'Region'
  },
  operator: 'In',
  values: ['North America']
};

report.getFilters().then(filters => {
  filters.push(filter);
  return report.setFilters(filters);
}).catch(error => {
  console.error(error);
});

Capture Events from an Embedded Report

This code demonstrates how to capture events from an embedded Power BI report. It listens for 'loaded', 'rendered', and 'error' events and logs the corresponding messages to the console.

report.on('loaded', function() {
  console.log('Report loaded');
});

report.on('rendered', function() {
  console.log('Report rendered');
});

report.on('error', function(event) {
  console.error(event.detail);
});

Other packages similar to powerbi-client

Keywords

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc